<template>
  <div>
    <van-tabs @click="onClick">
      <van-tab v-for="item in cate" :key="item.id" :title="item.catename"></van-tab>
    </van-tabs>
  </div>
</template>

<script>
import { mapActions, mapGetters } from 'vuex';
export default {
  computed:{
    ...mapGetters({
      cate:"home/cate"
    })
  },
  mounted() {
    this.reqcate();
  },
  methods: {
    ...mapActions({
      reqcate:"home/reqcate"
    }),
    onClick(index) {
      this.$router.push("/list?id=" + this.cate[index].id);
    }
  }
};
</script>

<style>
</style>